C++ Builder5使い方メモ
Breakの使い方
Breakは、何か書いてある所に貼ると、そこまで実行され、そこでプログラムが停止する。
2個置くと、1個めのブレイクまで実行、一時停止、もう一度実行を押すと、2個めのBreakまで実行し、一時停止、
もう一度実行すると最後まで実行される。
という動きをする。
監視の使い方
監視したい変数を設定する。 例:c
ブレークポイントを設定する。
監視ウィンドウに最初は監視できませんと表示される。
ブレークされ、値が決定されると、監視の部分に値が表示される。
ローカル変数
ブレークした所までのローカル変数の値を自動的に表示してくれる。
CodeGuidログ
構文ルールには違反していないためにコンパイラでは検知されないエラーを報告します。CodeGuard は、マルチスレッド アプリケーションをフル サポートし、実行時ライブラリを追跡します。
参考:https://docwiki.embarcadero.com/RADStudio/Sydney/ja/[CodeGuard_ログ]
https://docwiki.embarcadero.com/RADStudio/Sydney/ja/CodeGuard_のエラー:インデックス
システム例外が発生すると、CodeGuard は、オペレーティング システムから提供される情報を使って実行時エラーを報告します。可能であれば、アプリケーションのどこで例外が発生したかが CodeGuard のログに示されます。CodeGuard は、例外のトラップやリダイレクトなど、プログラムの通常の動作を妨げることはしません。
testプログラム
code:c++
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "main.h"
#include <vcl.h>
#include <map>
#include <deque>
using namespace std;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
///C++Builder2009以降はUnicodeStringを通常の文字列型にし、
///それ以前はAnsiStringを通常の文字列型にする。
#if __BORLANDC__>=0x610
typedef UnicodeString DefString;
#else
typedef AnsiString DefString;
#endif
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
OutputDebugString("test");
int a =10;
int b = 20;
int c = 0;
DefString str;
c=a+b;
str = str.sprintf("c=%d",c);
OutputDebugString(str.c_str());
}
//---------------------------------------------------------------------------
文字、10進数、16進数の出力
code:c++
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "main.h"
using namespace std;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
///C++Builder2009以降はUnicodeStringを通常の文字列型にし、
///それ以前はAnsiStringを通常の文字列型にする。
#if __BORLANDC__>=0x610
typedef UnicodeString DefString;
#else
typedef AnsiString DefString;
#endif
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
//ボタンを押すと、aを10進数と、16進数で表示確認
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
OutputDebugString("test");
int a = 122;
char b = 'W';
DefString str1;
DefString str2;
str1 = str1.sprintf("b(文字のまま出力)=%c",b);
OutputDebugString(str1.c_str());
str1 ="(16進数表示)b="+IntToHex(b,2);
OutputDebugString(str1.c_str());
str1 ="(10進数表示)b="+IntToStr(b);
OutputDebugString(str1.c_str());
str2 ="(10進数表示)a="+IntToStr(a);
OutputDebugString(str2.c_str());
str2 ="(16進数表示)a="+IntToHex(a,2);
OutputDebugString(str2.c_str());
str2 ="(16進数表示、4桁)a="+IntToHex(a,4);
OutputDebugString(str2.c_str());
}
//---------------------------------------------------------------------------